package com.aqie.easy.greedy;

import java.util.ArrayList;
import java.util.List;

/**
 * 944. 删列造序
 * A = ["abcdef", "uvwxyz"] 删除索引序列 {0, 2, 3}
 */
public class MinDeletionSize {
    public int minDeletionSize(String[] A) {
        if (A.length <= 1) return 0;
        List<Integer> list = new ArrayList<>();
        for (int j = 0; j < A[0].length(); j++ ){
            int flag = 1;
            for(int i = 0; i < A.length - 1; i++){
                if (A[i].charAt(j) <= A[i+1].charAt(j)){
                    flag = 1;
                }else {
                    flag = 0;
                    break;
                }
            }
            if (flag == 0) list.add(j);
        }

        return list.size();
    }

    public static void main(String[] args) {
        System.out.println((int)'a');   // 97
        System.out.println((int)'z');   // 122
    }
}
